package com.itheima.composite;

/**
 * @author zzw
 * @date 2025/10/19
 * @description 菜单项（叶子节点）
 */
public class MenuItem extends MenuComponent {

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.println("--");
        }
        System.out.println(name);
    }
}
